package com.xzlf.vo;

import lombok.Data;

import java.io.Serializable;

@Data
public class R<T> implements Serializable {

    private String msg;
    private T data;
    private int  code;

    public static <T> R<T> ok(){
        return result("ok",200,null);
    }
    public static <T> R<T> ok(T data){
        return result("ok",200,data);
    }

    public static <T> R<T> result(String msg, int code, T data){
        R<T> r = new R<>();
        r.setCode(code);
        r.setMsg(msg);
        r.setData(data);
        return r;
    }
}
